Field of the Invention
The present invention relates to instruction compression. More particularly, the present invention relates to a method for compressing instructions and a processor for executing compressed instructions.
Description of the Related Art
The length of an instruction set is the length in bits of each instruction in the instruction set. A long instruction can encode more operations. For example, moving a big constant to a register can be encoded as a long instruction. However, a long instruction set enlarges program code size. To reduce code size, frequently used long instructions can be compressed by encoding them as short instructions if the encoding length is enough.
In the conventional instruction compression, the mapping between the long instructions and the short instructions are fixed to all programs. In a program, if its frequently used long instructions do not have the short instruction mapping, the code size of this program can not be saved.